﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.CUiAPPErrorWindow
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using Tecnomatix.Engineering.Ui.WPF;


namespace DnProcessSimulateCommands;

public class CUiAPPErrorWindow : TxWindow, IComponentConnector
{
  private readonly CUiAPPErrorWindow.ButtonState m_buttonState;
  internal TextBlock m_errorText;
  internal TextBox m_detailsTextBox;
  internal Button m_continueButton;
  internal Button m_abortButton;
  private bool _contentLoaded;

  public CUiAPPErrorWindow(
    string errorMessage,
    string errorDetails,
    CUiAPPErrorWindow.ButtonState buttonState)
  {
    this.m_buttonState = buttonState;
    this.InitializeComponent();
    this.m_errorText.Text = errorMessage;
    this.m_detailsTextBox.Text = errorDetails;
  }

  public bool IsContinueButtonVisible => this.m_buttonState == CUiAPPErrorWindow.ButtonState.Both;

  private void Window_Loaded(object sender, RoutedEventArgs e)
  {
    // ISSUE: explicit non-virtual call
    __nonvirtual (((FrameworkElement) this).Height) = ((FrameworkElement) this).ActualHeight;
    ((FrameworkElement) this).MinHeight = ((FrameworkElement) this).ActualHeight;
  }

  private void Expander_Expanded(object sender, RoutedEventArgs e)
  {
    ((FrameworkElement) this).MinHeight = ((FrameworkElement) this).MinHeight + 100.0;
  }

  private void Expander_Collapsed(object sender, RoutedEventArgs e)
  {
    ((FrameworkElement) this).MinHeight = ((FrameworkElement) this).MinHeight - 100.0;
    // ISSUE: explicit non-virtual call
    __nonvirtual (((FrameworkElement) this).Height) = ((FrameworkElement) this).MinHeight;
  }

  private void ContinueButton_Click(object sender, RoutedEventArgs e)
  {
    ((Window) this).DialogResult = new bool?(true);
    ((Window) this).Close();
  }

  private void AbortButton_Click(object sender, RoutedEventArgs e)
  {
    ((Window) this).DialogResult = new bool?(false);
    ((Window) this).Close();
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  public void InitializeComponent()
  {
    if (this._contentLoaded)
      return;
    this._contentLoaded = true;
    Application.LoadComponent((object) this, new Uri("/DnProcessSimulateCommands;component/automaticpathplanner/cuiapperrorwindow.xaml", UriKind.Relative));
  }

  [DebuggerNonUserCode]
  [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
  [EditorBrowsable(EditorBrowsableState.Never)]
  void IComponentConnector.Connect(int connectionId, object target)
  {
    switch (connectionId)
    {
      case 1:
        ((FrameworkElement) target).Loaded += new RoutedEventHandler(this.Window_Loaded);
        break;
      case 2:
        this.m_errorText = (TextBlock) target;
        break;
      case 3:
        ((Expander) target).Expanded += new RoutedEventHandler(this.Expander_Expanded);
        ((Expander) target).Collapsed += new RoutedEventHandler(this.Expander_Collapsed);
        break;
      case 4:
        this.m_detailsTextBox = (TextBox) target;
        break;
      case 5:
        this.m_continueButton = (Button) target;
        this.m_continueButton.Click += new RoutedEventHandler(this.ContinueButton_Click);
        break;
      case 6:
        this.m_abortButton = (Button) target;
        this.m_abortButton.Click += new RoutedEventHandler(this.AbortButton_Click);
        break;
      default:
        this._contentLoaded = true;
        break;
    }
  }

  public enum ButtonState
  {
    Both,
    AbortOnly,
  }
}
